package an_sim;

public class Policy {

	private int required;
	private int provided;


        Policy(int p, int r){
            this.provided=p;
            this.required=r;
        }
	public int getProvided() {
		return provided;
	}

	public int getRequired() {
		return required;
	}

	public void setProvided(int a) {
		this.provided=a;
	}

	public void setRequired(int a) {
		this.required=a;
	}
        public boolean checkPolicy(Policy a){
            return (a.required <= this.provided) && (this.required<= a.provided);
        }
        public Policy newPolicyAbs(Policy a){
            int newProvided=(a.provided+this.provided)/2;
         if(a.required>this.required) return (new Policy(newProvided,a.required)); else return (new Policy(newProvided,this.required));
    }
        public Policy newPolicyGw(Policy a){
            int newProvided=(a.provided+this.provided)/2;
         if(a.required>this.required) return (new Policy(newProvided,this.required)); else return (new Policy(newProvided,a.required));
    }

        }
